﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SaleOnlineSystem.Controls
{
    public partial class PaymentCartLeft : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            rdb1.Text = "Thanh toán tiền mặt khi nhận hàng";
            rdb2.Text = "Thanh toán bằng thẻ quốc tế: Visa, Master Card";
            rdb3.Text = "Thông tin tài khoản ngân hàng";
            if (BOL.Shopping.ShoppingCart.Instance.getQuantityProduct() == 0)
            {
                Button1.Enabled = false;
            }
            else {
                Button1.Enabled = true;
            }

            rpt_bank.DataSource = DAL.DCollector.DBCollector.Instance.StoredProcedureSelectByColumns("tbl_Bank", " * ", "selectbycolumns");

            rpt_bank.DataBind();
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            string payment = "";
            if (rdb1.Checked == true)
            {
                payment = rdb1.Text;
            }
            if (rdb2.Checked == true)
            {
                payment = rdb2.Text;

            }
            if (rdb3.Checked == true)
            {
                payment = rdb3.Text;
            }
            BOL.Shopping.ShoppingCart.Instance.payment = payment;
            Response.Redirect("/hoadon.htm");
        }
    }
}